{% extends "base_jrcadmin2.html" %}

{% block extrastyle %}
{% endblock %}

{% block content %}

	<table>
		<tr>
			<td>
				<div class="selector-available">
				<h2>Available users</h2>
				<select class="filtered" size="10">
					{% for u in users %}
						<option value="{{ u.pk }}">{{ u.username }}</option>
					{% empty %}
						<option disabled="true">No users</option>
					{% endfor %}
				</select>
				</div>
			</td>
			<td>
				<div class="selector-available">
				<h2>Permission for applications</h2>
				{% for app in apps %}
					<input type="checkbox" value="{{ app.pk }}"> {{ app.name }}<br />
				{% empty %}
					No applications
				{% endfor %}
				</div>
			</td>
		</tr>
	</table>

	<table>
		<tr>
			<td>Username</td><td><b>{{ user.username }}</b></td>
		</tr>
		<tr>
			<td>Is active</td><td><b>{{ user.is_active }}</b></td>
		</tr>
		<tr>
			<td>Is admin</td><td><b>{{ user.is_staff }}</b></td>
		</tr>
	</table>

	<table>
		<tr>
			<th>Has</th>
			<th>Content type</th>
			<th>Name</th>
			<th>Codename</th>
		</tr>
	{% for p in permissions %}
		<tr class="{% cycle "row1" "row2" %}">
			<td><input type="checkbox" checked="checked"/></td>
			<td>{{ p.content_type }}</td>
			<td>{{ p.name }}</td>
			<td>{{ p.codename }}</td>
		</tr>
	{% empty %}
		
	{% endfor %}
	</table>

	<table>
		<tr>
			<th>PK</th>
			<th>Edit</th>
		</tr>
	{% if user.is_authenticated %}

		{% for r in rows %}
			<tr>
				<td>{{ r }}</td>
				<td><a href="/test/permissions/{{ r }}/" class="changelink"> </a></td>
			</tr>
		{% endfor %}

	{% else %}

		{% for r in rows %}
			<tr>
				<td>{{ r }}</td>
				<td>N/A</td>
			</tr>
		{% endfor %}

	{% endif %}
	<table>
	
	<h3>Second variant</h3>
	<table>
		<tr>
			<th>PK</th>
			<th>Edit</th>
		</tr>
	
	{% if user.is_authenticated %}

		{% for r in rows %}
			<tr>
				<td>{{ r }}</td>
				<td><a href="/test/permissions/{{ r }}/" class="changelink"> </a></td>
			</tr>
		{% endfor %}

	{% else %}

		You need to <a href="/accounts/login/?next=/test/permissions/">login</a> to see this :)

	{% endif %}

	
	</table>

{% endblock %}
